package com.attendance.service.impl;

import com.attendance.common.BaseContext;
import com.attendance.common.DateInsert;
import com.attendance.entity.Kpi;
import com.attendance.service.KpiService;

import java.util.Date;

public class KpiServiceImpl implements KpiService {
    @Override
    public void savaKpi(Kpi kpi) {
       int score=kpi.getAttendance()+ kpi.getExperienceSharing()+kpi.getWorkDifficulty()+ kpi.getWorkEfficiency()
       +kpi.getWorkLoad()+kpi.getWorkLoadPerson()+kpi.getWorkEfficiency_person()+kpi.getExperienceSharing()+
               kpi.getWorkDifficulty_person();
        kpi .setStatus(3);
        kpi.setScore(score);
        kpi.setEmp_id(BaseContext.getEmployee().getId());

        if (kpi.getType().equals("m")){
kpi.setDate(String.valueOf(DateInsert.getMonth(new Date())));
        }else {
            kpi.setDate(String.valueOf(DateInsert.getWeekToMonth(new Date())));
        }
    }
}
